import {Injectable} from '@angular/core';
import {Http} from './http';

/**
 * 用户登录服务
 */

@Injectable()
export class Service {
  constructor(private http: Http) {}

  // 分类
  classifyAdd(data, callbackFun) {
    this.http.request('admin/classify/add',
      data
      , callbackFun);
  }

  classifyUpdate(data, callbackFun) {
    this.http.request('admin/classify/update',
      data
      , callbackFun);
  }

  classifyQuery(data, callbackFun) {
    this.http.request('admin/classify/get',
      data
      , callbackFun);
  }

  // 用户
  getAllUser(data, callbackFun) {
    this.http.request('admin/user/get',
      data
      , callbackFun);
  }

  // 商铺
  storeQuery(data, callbackFun) {
    this.http.request('admin/store/get',
      data
      , callbackFun);
  }

  storeCheck(data, callbackFun) {
    this.http.request('admin/store/check',
      data
      , callbackFun);
  }

  // 轮播
  bannerAdd(data, callbackFun) {
    this.http.request('admin/banner/add',
      data
      , callbackFun);
  }

  bannerQuery(data, callbackFun) {
    this.http.request('admin/banner/getList',
      data
      , callbackFun);
  }

  bannerUpdate(data, callbackFun) {
    this.http.request('admin/banner/update',
      data
      , callbackFun);
  }
  // 登录
  login(data, callbackFun) {
    console.log(data,callbackFun);
    console.log("---------")
    this.http.request('admin/account/login',
      data
      , callbackFun);
  }
  // 骑手
  getAllExpress(data, callbackFun) {
    this.http.request('admin/express/getlist',
      data
      , callbackFun);
  }
  getAllCheck(data, callbackFun) {
    this.http.request('admin/express/check',
      data
      , callbackFun);
  }
  // 商品
  getAllProduct(data, callbackFun) {
    this.http.request('admin/product/getlist',
      data
      , callbackFun);
  }
  // 上传
  uploadImg(data, callbackFun) {
    this.http.upload('admin/upload/file',
      data
      , callbackFun);
  }
  // 分类图片上传
  uploadClassifyImg(data, callbackFun) {
    this.http.upload('admin/classify/setimg',
      data
      , callbackFun);
  }
}
